import java.util.Arrays;
import java.util.Scanner;

public class MainOfGiant {
    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
        Giant[] giants = new Giant[4];
        for(int i = 0; i < giants.length; i++)
        {
            giants[i] = new Giant(read.next(),read.nextDouble());
        }
        Arrays.sort(giants);
        System.out.println(Arrays.toString(giants));
    }
}
